package edu.neusoft.springhtmldemo.controller;

import edu.neusoft.springhtmldemo.domain.BroadcastManagement;
import edu.neusoft.springhtmldemo.service.BroadcastManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BroadcastManagementController {
    @Autowired
    private BroadcastManagementService service;

    @RequestMapping("showBroadcastManagement")
    public List<BroadcastManagement> showBroadcastManagement(){
        List<BroadcastManagement> list=service.showAll();
//        for (BroadcastManagement broadcastManagement : list) {
//            System.out.println(broadcastManagement);
//        }
        return list;
    }

    @RequestMapping("selectBroadcastManagement")
    public List<BroadcastManagement> selectBroadcastManagement(BroadcastManagement management){
        return service.selectBroadcastManagement(management);
    }

    @RequestMapping("updateBroadcastManagement")
    public void updateBroadcastManagement(BroadcastManagement management){
        service.updateBroadcastManagement(management);
    }

    @RequestMapping("addBroadcastManagement")
    public void addBroadcastManagement(BroadcastManagement management){
        service.addBroadcastManagement(management);
    }

    @RequestMapping("delBroadcastManagement")
    public void delBroadcastManagement(Integer broadcastID){
        service.delBroadcastManagement(broadcastID);
    }

    @RequestMapping("broadcastIPValues")
    public List<String> broadcastIPValues(){
        return service.broadcastIPValues();
    }

    @RequestMapping("broadcastNameValue")
    public String broadcastNameValue(String broadcastIP){
        return service.broadcastNameValue(broadcastIP);
    }
}
